package kr.hkit.androidcomplete01.ch06.work;

import android.app.Activity;
import android.os.Bundle;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class workTest extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		RelativeLayout rela = new RelativeLayout(this);

		TextView txt1 = new TextView(this);
		txt1.setId(1);
		txt1.setText("찰수");
		txt1.setTextSize(30);

		RelativeLayout.LayoutParams cs = new RelativeLayout.LayoutParams(
				RelativeLayout.LayoutParams.WRAP_CONTENT,
				RelativeLayout.LayoutParams.WRAP_CONTENT);
		cs.setMargins(0, 0, 20, 0);
		rela.addView(txt1, cs);

		TextView txt2 = new TextView(this);
		txt2.setId(2);
		txt2.setText("영희");
		txt2.setTextSize(20);
		RelativeLayout.LayoutParams yh = new RelativeLayout.LayoutParams(
				RelativeLayout.LayoutParams.WRAP_CONTENT,
				RelativeLayout.LayoutParams.WRAP_CONTENT);
		yh.addRule(RelativeLayout.RIGHT_OF, txt1.getId());
		rela.addView(txt2, yh);

		TextView txt3 = new TextView(this);
		txt3.setId(3);
		txt3.setText("몽룡");
		txt3.setTextSize(30);
		RelativeLayout.LayoutParams mr = new RelativeLayout.LayoutParams(
				RelativeLayout.LayoutParams.WRAP_CONTENT,
				RelativeLayout.LayoutParams.WRAP_CONTENT);
		mr.addRule(RelativeLayout.BELOW, txt2.getId());
		mr.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
		mr.setMargins(10, 0, 0, 0);
		rela.addView(txt3, mr);

		TextView txt4 = new TextView(this);
		txt4.setId(4);
		txt4.setText("춘향");
		txt4.setTextSize(20);
		RelativeLayout.LayoutParams ch = new RelativeLayout.LayoutParams(
				RelativeLayout.LayoutParams.WRAP_CONTENT,
				RelativeLayout.LayoutParams.WRAP_CONTENT);
		ch.addRule(RelativeLayout.LEFT_OF, txt3.getId());
		ch.addRule(RelativeLayout.ALIGN_BOTTOM, txt3.getId());
		rela.addView(txt4, ch);

		setContentView(rela);
	}
}
